home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2004 New Year / INTERNET112.ISO / pc / software / windows / building / easy_php / easyphp16_setup.exe / {app} / home / index.php < prev    next >
Encoding:
PHP Script  |  2003-09-24  |  18.6 KB  |  557 lines

  1. <html>
  2.  
  3. <head>
  4. <meta http-equiv="Content-Type"
  5. content="text/html; charset=iso-8859-1">
  6. <title>[EasyPHP] - Administration</title>
  7.  
  8. <style type="text/css">
  9. .text1 {font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #CCCCCC}
  10. .text2 {font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #999999}
  11. .titre1 {font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; color: #FFFFFF}
  12. </style>
  13.  
  14. </head>
  15.  
  16. <body bgcolor="#505F70" vlink="#CCCCCC" alink="#CCCCCC" link="#CCCCCC">
  17.  
  18. <?
  19. if (isset($HTTP_GET_VARS)){
  20.     while(list($name, $value) = each($HTTP_GET_VARS)){
  21.         $$name = $value;
  22.     }
  23. }
  24. if (!isset($to)) $to = '';
  25. if (!isset($ext)) $ext = '';
  26. if (!isset($ext)) $do = '';
  27. if (!isset($ext)) $directory = '';
  28.  
  29. ?>
  30.  
  31. <table width="700" border="0" cellspacing="0" cellpadding="0" align="center">
  32.     <tr valign="bottom"> 
  33.         <td> 
  34.             <div align="left">  <img src="images_easyphp/easyphp_anim.gif" width="69" height="23" align="absbottom"></div>
  35.         </td>
  36.     </tr>
  37. </table>
  38.  
  39. <table width="700" border="0" cellspacing="0" cellpadding="0" align="center">
  40.     <tr> 
  41.         <td> 
  42.             <table width="100%" border="0" cellspacing="0" cellpadding="0">
  43.                 <tr> 
  44.                     <td> 
  45.                         <div align="center"><img src="images_easyphp/barre_blanche_700.gif" width="700" height="6"></div>
  46.                     </td>
  47.                 </tr>
  48.                 <tr> 
  49.                     <td> 
  50.                         <div align="center"><img src="images_easyphp/barre_grise_700.gif" width="700" height="12"></div>
  51.                     </td>
  52.                 </tr>
  53.             </table>
  54.         </td>
  55.     </tr>
  56. </table>
  57.  
  58. <table width="700" border="0" cellspacing="0" cellpadding="0" align="center">
  59.   <tr>
  60.     <td>
  61.       <div align="right"><img src="images_easyphp/administration.gif" width="141" height="13"></div>
  62.     </td>
  63.   </tr>
  64. </table>
  65. <table width="700" border="0" cellspacing="0" cellpadding="0" align="center">
  66.     <tr> 
  67.         <td nowrap valign="top" class="titre1" rowspan="3">
  68.             <img src="images_easyphp/carre_gris.gif" width="8" height="8"> Vos alias :
  69.         </td>
  70.         <td valign="top" width="100%" colspan="2"> 
  71.  
  72. <?
  73.  
  74. function read_alias(){
  75.     global $alias, $directory, $httpd_1, $httpd_2, $httpd_3, $nb_alias, $source;
  76.     
  77.     $source = "../apache/conf/httpd.conf";
  78.     
  79.     $fp = fopen($source, "r");
  80.     
  81.     while (!feof($fp)){
  82.         $conf = fgets($fp, 4096);
  83.         $httpd = $httpd.$conf;
  84.     }
  85.     
  86.     fclose($fp);
  87.     
  88.     $exp1 = explode("#alias",$httpd);
  89.     
  90.     $httpd_1 = $exp1[0];
  91.     $httpd_2 = $exp1[1];
  92.     $httpd_3 = $exp1[2];
  93.     
  94.     $exp2 = explode("Alias",$httpd_2);
  95.     
  96.     $n = 1;
  97.     while($exp2[$n]){
  98.         $exp3 = explode("<Directory",$exp2[$n]);
  99.         $alias[$n] = "Alias".$exp3[0];
  100.         $directory[$n] = "<Directory".$exp3[1];
  101.         $n++;
  102.     }
  103.     
  104.     $nb_alias = $n-1;
  105. }
  106.  
  107.  
  108. if ($to == "add_alias_1"){
  109. ?>
  110.             
  111. <form method="post" action="index.php">
  112. <span class=text1>  Les alias permettent de placer vos développements dans un ou plusieurs répertoires</span>
  113. <br>
  114. <span class=text1>  indépendamment du répertoire racine d'apache (www).</span>
  115. <br><br>
  116. <span class=text2>  1. </span>
  117. <span class=text1>créer votre répertoire (ex.: C:\weblocal\sites\site1)</span>
  118. <br>
  119. <span class=text2>  2. </span>
  120. <span class=text1>saisir un nom pour l'alias (ex.: site1)</span>
  121. <br>
  122.       <input type="text" name="alias_name" size="60">
  123. <br>
  124. <span class=text2>  3. </span>
  125. <span class=text1>saisir le chemin du répertoire créé (ex.: C:\weblocal\sites\site1)</span>
  126. <br>
  127.       <input type="text" name="alias_link" size="70">
  128. <br>
  129. <span class=text2>  4. </span>
  130. <span class=text1>paramètres par défaut du répertoire</span>
  131. <br>
  132.       <textarea name="dir" cols="65" rows="8" wrap="virtual">Options Indexes FollowSymLinks Includes
  133. AllowOverride All
  134. #Order allow,deny
  135. Allow from all
  136. </textarea>
  137. <br>
  138. <span class=text2>  5. </span>
  139. <span class=text1>valider</span>
  140. <br>
  141. <span class=text2>  6. </span>
  142. <span class=text1>deux cas :</span>
  143. </td>
  144. </tr>
  145. <tr> 
  146. <td>     </td>
  147. <td>
  148. <span class=text1>
  149. - si "prise en compte automatique des modifications de configuration d'apache" est coché :
  150. <br>
  151. attendre quelques secondes que le point rouge se remette à clignoter (apache et mysql en vert dans le statut)
  152. <br>
  153. - si "prise en compte automatique des modifications de configuration d'apache" n'est pas coché :
  154. <br>
  155. appuyer sur redémarrer et attendre quelques secondes que le point rouge se remette à clignoter (apache et mysql en vert dans le statut)
  156. </span>    
  157. </td>
  158. </tr>
  159. <tr> 
  160. <td colspan="2">
  161. <br>
  162.       <input type="hidden" name="to" value="add_alias_2">  <input type="submit" value="valider">
  163. <a href="javascript:history.back()"><img src="images_easyphp/bouton_retour_form.gif" width="51" height="24" border="0" align="absbottom"></a>
  164. </form>
  165. <span class=text2>rq : </span>
  166. <span class=text1>il existe une copie de secours du fichier httpd.conf dans le rÈpertoire "safe" : httpd-safe.conf</span>
  167.  
  168.             
  169. <?
  170. }else{
  171.     
  172.     if ($to == "add_alias_2"){
  173.         if ($alias_name == "" | $alias_link == "" | !is_dir($alias_link)){
  174.             if ($alias_name == ""){echo "<span class=text1>  ï le champ 2 est vide.</span><br>";}
  175.             if ($alias_link == ""){echo "<span class=text1>  ï le champ 3 est vide.</span><br>";}
  176.             if ($alias_link != "" & !is_dir($alias_link)){echo "<span class=text1>  ï le répertoire correspondant au chemin que vous avez saisi n'existe pas.</span><br>";}
  177.             echo "<span class=text1>  [ <a href=\"javascript:history.back()\" class=\"text2\">retour</a> ]</span></td></tr></table>";
  178.             clearstatcache();
  179.             exit;
  180.         }else{
  181.             read_alias();
  182.             
  183.             $dir = ereg_replace("\r\n","\n",$dir);
  184.             
  185.             $alias_link = stripslashes($alias_link);
  186.             $alias_link = str_replace("\\","/", $alias_link);
  187.             
  188.             if (substr($alias_link, -1) == "/"){$alias_link = substr($alias_link,0,strlen($alias_link)-1);}
  189.             
  190.             $new_alias = "Alias \"/";
  191.             $new_alias .= $alias_name;
  192.             $new_alias .= "/\" \"";
  193.             $new_alias .= $alias_link;
  194.             $new_alias .= "/\"\n";
  195.             $new_alias .= "<Directory \"$alias_link\">\n".$dir."</Directory>\n\n";
  196.             
  197.             $conf = $httpd_1."#alias".$httpd_2.$new_alias."#alias\n".$httpd_3;
  198.             
  199.             $fp2 = fopen($source, "w");
  200.             fputs($fp2,$conf);
  201.             fclose($fp2);
  202.         }
  203.     }
  204.     
  205.     if ($to == "del_alias"){
  206.         read_alias();
  207.         $conf_del_alias = $httpd_1."#alias\n";
  208.         $x = 1;
  209.         while($x<=$nb_alias){
  210.             if ($x != $num_alias){
  211.                 $conf_del_alias = $conf_del_alias.$alias[$x].$directory[$x];
  212.             }
  213.             $x++;
  214.         }
  215.         $conf_del_alias = $conf_del_alias."#alias\n".$httpd_3;
  216.         $fp3 = fopen($source, "w");
  217.         fputs($fp3,$conf_del_alias);
  218.         fclose($fp3);
  219.     }
  220.     
  221.     read_alias();
  222.     $inc = 1;
  223.     while($inc <= $nb_alias){
  224.         $exp4 = explode("\"",$alias[$inc]);
  225.         $exp5 = explode("/",$exp4[1]);
  226.         $alias_link = $exp4[3];
  227.         $alias_name = $exp5[1];
  228.         
  229.         echo "<span class=\"text1\">";
  230.         echo "    <img src=\"images_easyphp/dossier_alias.gif\" width=\"15\" height=\"12\"> ";
  231.         echo "<a href=\"../$alias_name/\" target=\"_blank\">$alias_name</a>    [ $alias_link ]    ";
  232.         echo "[ <a href=\"index.php?to=del_alias&num_alias=$inc\" class=text2>supprimer</a> ]<br>";
  233.         echo "</span>";
  234.         $inc++;
  235.     }
  236.     echo "<span class=text1>";
  237.     echo "    <img src=\"images_easyphp/dossier_alias.gif\" width=\"15\" height=\"12\"> ";
  238.     echo "...    ";
  239.     echo "[ <a href=\"index.php?to=add_alias_1\" class=text2>ajouter</a> ]<br>";
  240.     echo "</span>";
  241. }
  242. ?>        
  243.  
  244.         </td>
  245.     </tr>
  246. </table>
  247.  
  248. <br>
  249.  
  250. <table width="700" border="0" cellspacing="0" cellpadding="0" align="center">
  251.     <tr> 
  252.         <td nowrap valign="top" class="titre1" rowspan="3">
  253.             <img src="images_easyphp/carre_gris.gif" width="8" height="8"> Données MySQL (datadir) :
  254.         </td>
  255.         <td valign="top" width="100%" colspan="2"> 
  256.  
  257. <?
  258.  
  259. function read_myini(){
  260.     global $path_datadir,$fp,$default_datadir;
  261.     
  262.     $source = "../easyphp.ini";
  263.     
  264.     $fp = @fopen($source, "r");
  265.     
  266.     if ($fp) {
  267.         while (!feof($fp)){
  268.             $ligne = fgets($fp, 4096);
  269.             $prefixe = substr($ligne,0,6);
  270.             if ($prefixe == "Windir"){
  271.                 $split = explode("=",$ligne);
  272.                 $windir = $split[1];
  273.                 $windir = ereg_replace("\n","",$windir);
  274.             }
  275.             if ($prefixe == "datadi"){
  276.                 $split = explode("=",$ligne);
  277.                 $default_datadir = $split[1];
  278.                 $default_datadir = ereg_replace("\n","",$default_datadir);
  279.                 $default_datadir = addslashes($default_datadir);
  280.             }
  281.         }
  282.         fclose($fp);
  283.     }else{
  284.         echo "easyphp.ini est necessaire !!!<br>";
  285.     }
  286.     
  287.     $fp = @fopen($windir."/my.ini", "r");
  288.     if ($fp) {
  289.         while (!feof($fp)){
  290.             $ligne = fgets($fp, 4096);
  291.             $prefixe = substr($ligne,0,7);
  292.             if ($prefixe == "datadir"){
  293.                 $split = explode("=",$ligne);
  294.                 $path_datadir = "\"".$split[1]."\"";
  295.             }
  296.         }
  297.         fclose($fp);
  298.     }
  299. }
  300.  
  301. if ($to == "datadir_1"){
  302.     read_myini();
  303.     ?>
  304.     
  305.     <script language="JavaScript">
  306.         function defaut()
  307.         {
  308.         var legende = ("<? echo $default_datadir; ?>")
  309.         document.forms[0].new_path_datadir.value = legende
  310.         }
  311.     </script>
  312.  
  313.     <form method="post" action="index.php">
  314.     <span class=text1>  Les bases de données sont contenues par défaut dans le répertoire data de</span>
  315.     <br>
  316.     <span class=text1>  MySQL (ex.: "C:\Program Files\EasyPHP\mysql\data").</span>
  317.     <br>
  318.     <span class=text1>  Vous pouvez modifier ce répertoire</span>
  319.     <br><br>
  320.     <span class=text2>  1. </span>
  321.     <span class=text1>créer un nouveau répertoire</span>
  322.     <br>
  323.     <span class=text2>  2. </span>
  324.     <span class=text1>copier les bases de données dans le nouveau répertoire</span>
  325.     <br>
  326.     <span class=text2>  3. </span>
  327.     <span class=text1>modifier le chemin pour qu'il corresponde au nouveau répertoire</span>
  328.     <br>
  329.           <input type="text" name="new_path_datadir" size="45" value=<? echo $path_datadir; ?>>
  330.     <span class=text1>[ </span><a href="#" onclick="defaut()" class=text2>répertoire par défaut</a><span class=text1> ]</span>
  331.     <br>
  332.     <span class=text2>  4. </span>
  333.     <span class=text1>valider</span>
  334.     <br>
  335.     </td>
  336.     </tr>
  337.     <tr> 
  338.     <td valign="top"><span class=text2>  5. </span>
  339.     </td>
  340.     <td>
  341.     <span class=text1>
  342.     appuyer sur redémarrer et attendre quelques secondes que le point rouge se remette à clignoter (apache et mysql en vert dans le statut)
  343.     </span>    
  344.     </td>
  345.   </tr>
  346.   <tr> 
  347.   <td colspan="2">
  348.     <br>
  349.           <input type="hidden" name="to" value="datadir_2">  <input type="submit" value="valider">
  350.     <a href="javascript:history.back()"><img src="images_easyphp/bouton_retour_form.gif" width="51" height="24" border="0" align="absbottom"></a>
  351.     </form>
  352.     <span class=text2>rq : </span>
  353.     <span class=text1>il existe une copie de secours du fichier my.ini dans le rÈpertoire "safe" : my-safe.ini</span>
  354.  
  355.     <?
  356.     }else{
  357.         if ($to == "datadir_2"){
  358.             if ($new_path_datadir == "" | !is_dir($new_path_datadir)){
  359.                 if ($new_path_datadir == ""){echo "<span class=text1>  ï vous n'avez pas saisi de chemin.</span><br>";}
  360.                 if ($new_path_datadir != "" & !is_dir($new_path_datadir)){echo "<span class=text1>  ï le répertoire correspondant au chemin que vous avez saisi n'existe pas.</span><br>";}
  361.                 echo "<span class=text1>  [ <a href=\"javascript:history.back()\" class=\"text2\">retour</a> ]</span></td></tr></table>";
  362.                 clearstatcache();
  363.                 exit;
  364.             }else{
  365.                 $source = "../easyphp.ini";
  366.                 $fp = @fopen($source, "r");
  367.                 if ($fp) {
  368.                     while (!feof($fp)){
  369.                         $ligne = fgets($fp, 4096);
  370.                         $prefixe = substr($ligne,0,6);
  371.                         if ($prefixe == "Windir"){
  372.                             $split = explode("=",$ligne);
  373.                             $windir = $split[1];
  374.                             $windir = ereg_replace("\n","",$windir);
  375.                         }
  376.                     }
  377.                     fclose($fp);
  378.                 }else{
  379.                     echo "easyphp.ini est necessaire !!!<br>";
  380.                 }
  381.                 
  382.                 $fp = fopen($windir."/my.ini", "r");
  383.                 
  384.                 while (!feof($fp)){
  385.                     $ligne = fgets($fp, 4096);
  386.                     $prefixe = substr($ligne,0,7);
  387.                     if ($prefixe == "datadir"){
  388.                         $split = explode("=",$ligne);
  389.                         $path_datadir = $split[1];
  390.                         $new_path_datadir = stripslashes($new_path_datadir);
  391.                         $ligne = $split[0]."=".$new_path_datadir."\n";
  392.                     }
  393.                     $new_myini = $new_myini.$ligne;
  394.                 }
  395.                 //$new_myini = stripslashes($new_myini);
  396.                 //$new_myini = str_replace("\"","", $new_myini);
  397.                 fclose($fp);
  398.                 
  399.                 $fp = fopen($windir."/my.ini", "w+");
  400.                 fputs($fp,$new_myini);
  401.                 fclose($fp);
  402.             }
  403.         }
  404.         
  405.         read_myini();
  406.         if ($fp){
  407.             echo "<span class=\"text1\">";
  408.             echo "  répertoire actuel : $path_datadir    ";
  409.             echo "[ <a href=\"index.php?to=datadir_1\" class=text2>modifier</a> ]<br>";
  410.             echo "</span>";
  411.         }else{
  412.             echo "<span class=text1>  pas de myini</span><br>";
  413.         }
  414.     }
  415.     ?>        
  416.  
  417.         </td>
  418.     </tr>
  419. </table>
  420.  
  421. <br>
  422.  
  423. <table width="701" border="0" cellspacing="0" cellpadding="0" align="center">
  424.   <tr> 
  425.     <td colspan="2" class=titre1>
  426.       <img src="images_easyphp/carre_gris.gif" width="8" height="8"> Administrez vos bases de données :
  427.     </td>
  428.   </tr>
  429.   <tr> 
  430.     <td rowspan="3">     </td>
  431.     <td width="100%" class=text1> 
  432.       <div align="center">Cliquez 
  433.         sur le bouton ci-dessous pour accéder à l'administration 
  434.         des bases de données.</div>
  435.     </td>
  436.   </tr>
  437.   <tr> 
  438.     <td rowspan="2"> 
  439.       <div align="center"><a href="/mysql/" target="_blank"><img src="images_easyphp/bouton_phpmyadmin.gif" width="106" height="20" border="0"></a></div>
  440.     </td>
  441.   </tr>
  442.   <tr> </tr>
  443.   <tr> 
  444.     <td colspan="2" class=titre1>
  445.       <img src="images_easyphp/carre_gris.gif" width="8" height="8"> Environnement EasyPHP :</td>
  446.   </tr>
  447.   <tr> 
  448.     <td> </td>
  449.     <td class=text1> 
  450.       <div align="center">Ces 
  451.         pages vous informeront sur le bon fonctionnement de PHP, sa configuration 
  452.         et sur les éléments installés.<br>
  453.         <br>
  454.         </div>
  455.     </td>
  456.   </tr>
  457.   <tr> 
  458.     <td> </td>
  459.     <td> 
  460.       <div align="center">
  461.       <a href="index.php?to=phpinfo"><img src="images_easyphp/bouton_infosphp.gif" width="69" height="16" border="0"></a> 
  462.       <a href="index.php?to=ext"><img src="images_easyphp/bouton_extensions.gif" width="80" height="16" border="0"></a> 
  463.       <a href="index.php?to=mdp"><img src="images_easyphp/bouton_parametres.gif" width="85" height="16" border="0"></a>    
  464.       <a href="index.php"><img src="images_easyphp/bouton_retour.gif" width="51" height="16" border="0"></a></div>
  465.     </td>
  466.   </tr>
  467.   <tr> 
  468.     <td> </td>
  469.     <td> 
  470.       <div align="center"> 
  471.         <hr width="500">
  472.       </div>
  473.     </td>
  474.   </tr>
  475. </table>
  476. <table width="700" border="0" cellspacing="0" cellpadding="0" align="center"> 
  477.   <tr> 
  478.     <td> 
  479.       <div align="left">     </div>
  480.     </td>
  481.     <td class=text1>
  482.       <?
  483.       
  484.       
  485. if ($to=="ext")
  486. {
  487. $extensions = @get_loaded_extensions();
  488. echo "<center>Gestion des extensions : vous avez ".count($extensions)." extensions chargées</center><br>";
  489. @sort($extensions);
  490. foreach($extensions as $extension)
  491. {
  492.   echo "                                                  <img src=\"images_easyphp/carre_rouge.gif\" width=\"5\" height=\"5\"> $extension   <a href=\"index.php?to=ext&ext=$extension\" class=text2>listes des fonctions</a><br>\n";
  493.   if ($extension==$ext)
  494.   {
  495.    $functions = @get_extension_funcs($ext);
  496.    @sort($functions);
  497.    foreach($functions as $function)
  498.    {
  499.      print "                                                                  $function<br>\n";
  500.    }
  501.   }
  502. }
  503.  
  504.  
  505. }
  506. elseif ($to=="phpinfo")
  507. {
  508.  
  509. ?>
  510.  
  511. </td>
  512. </tr>
  513. </table>
  514.  
  515. <br>
  516.  
  517. <?
  518. phpinfo();
  519.  
  520.  
  521. }
  522. elseif ($to=="mdp")
  523. {
  524.  
  525. echo "Paramètres par défaut de la base de données :<br>";
  526. echo "                                                       serveur : \"localhost\"<br>";
  527. echo "                                                       username : \"root\"<br>";
  528. echo "                                                       mot de passe : \"\"<br>";
  529.  
  530.  
  531. }else{
  532. ?>
  533.         Bienvenue dans votre environnement EasyPHP.<br>
  534.         Si vous voyez cette phrase, PHP fonctionne. Pour vérifier le fonctionnement 
  535.         de MySQL, vous pouvez accéder au centre d'administration : "PhpMyAdmin".<br>
  536.         Si vous rencontrez des problèmes, reportez vous au site d'EasyPHP : <a href="http://www.easyphp.org">www.easyphp.org</a><br>
  537.         <?php
  538. }
  539.  
  540. ?>
  541.       </td>
  542.   </tr>
  543. </table>
  544. <table width="700" border="0" cellspacing="0" cellpadding="0" align="center">
  545.   <tr> 
  546.     <td>
  547.       <div align="center"> </div>
  548.     </td>
  549.   </tr>
  550.   <tr>
  551.     <td><img src="images_easyphp/barre_grise_700.gif" width="700" height="12"></td>
  552.   </tr>
  553. </table>
  554.  
  555. </body>
  556. </html>
  557.